<?php

/**
 * Verifies if URL is active
 */
function is_active($url, $params) {
    $route = Router::parse($url);
    return $params['controller']==$route['controller'] && $params['action']==$route['action'];
}

function date_local($date, $format="d.M Y") {
    $monthNames = array("Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul",
                        "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar");
    $time = strtotime($date);
    if ($time < 1) {
        return '';
    }
    
    // preserve Month pattern chars
    $format = str_replace("M", "{\M}", $format);
    $format = str_replace("F", "{\F}", $format);
    // create date
    $date   = date($format, $time);
    // replace month names
    $month     = (int)date("m", $time) - 1;
    $monthName = $monthNames[$month];
    $date      = str_replace("{M}", substr($monthName, 0, 3), $date);
	$date      = str_replace("{F}", $monthName, $date);
    
    return $date;
}
?>